﻿package mortal.common.net
{
    import Engine.RMI.*;
    import Framework.Protocol.CDFProtocol.*;
    import com.gengine.core.*;
    import flash.events.*;

    public class RMISession extends Object
    {
        private var _session:Session;
        private var _url:String;
        private var _comm:Communicator;

        public function RMISession()
        {
            return;
        }// end function

        public function get session() : Session
        {
            return this._session;
        }// end function

        public function set url(param1:String) : void
        {
            if (this._url != param1)
            {
                this._url = param1;
                this._session = new Session();
                this.createCommunicator();
                this._session.bindCommunicator(this._comm);
            }
            return;
        }// end function

        public function get url() : String
        {
            return this._url;
        }// end function

        protected function createCommunicator() : Communicator
        {
            this._comm = CommunicatorManager.getInstance().createCommunicator(this._url, new GroupProtocol(new Protocol()));
            this._comm.connection.addEventListener("网络数据处理时间", this.onTestNetCommandTime);
            return this._comm;
        }// end function

        private function onTestNetCommandTime(event:DataEvent) : void
        {
            var _loc_2:* = parseInt(event.data);
            FrameUtil.messageProTimer = FrameUtil.messageProTimer + _loc_2;
            return;
        }// end function

        public function registerProxy(param1:RMIProxyObject) : void
        {
            param1.bindingSession(this._session);
            return;
        }// end function

    }
}
